.class Landroid/widget/MyAbsListView$FlingRunnable;
.super Ljava/lang/Object;
.source "MyAbsListView.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/MyAbsListView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "FlingRunnable"
.end annotation


# static fields
.field private static final CORRECT_DURATION:I = 0x320


# instance fields
.field private mLastFlingY:I

.field private mScroller:Landroid/widget/MyScroller;

.field final synthetic this$0:Landroid/widget/MyAbsListView;


# direct methods
.method public constructor <init>(Landroid/widget/MyAbsListView;)V
    .locals 2
    .parameter

    .prologue
    .line 2234
    iput-object p1, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2235
    new-instance v0, Landroid/widget/MyScroller;

    invoke-virtual {p1}, Landroid/widget/MyAbsListView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/widget/MyScroller;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    .line 2236
    return-void
.end method

.method private endFling()V
    .locals 2

    .prologue
    .line 2255
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/MyScroller;->forceFinished(Z)V

    .line 2260
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/MyAbsListView;->reportScrollStateChange(I)V

    .line 2262
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    #calls: Landroid/widget/MyAbsListView;->clearScrollingCache()V
    invoke-static {v0}, Landroid/widget/MyAbsListView;->access$900(Landroid/widget/MyAbsListView;)V

    .line 2266
    return-void
.end method


# virtual methods
.method public run()V
    .locals 11

    .prologue
    const/4 v10, 0x1

    .line 2284
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v8, v8, Landroid/widget/MyAbsListView;->mItemCount:I

    if-eqz v8, :cond_0

    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8}, Landroid/widget/MyAbsListView;->getChildCount()I

    move-result v8

    if-nez v8, :cond_1

    .line 2285
    :cond_0
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    invoke-virtual {v8, v10}, Landroid/widget/MyScroller;->forceFinished(Z)V

    .line 2286
    invoke-direct {p0}, Landroid/widget/MyAbsListView$FlingRunnable;->endFling()V

    .line 2343
    :goto_0
    return-void

    .line 2290
    :cond_1
    iget-object v6, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    .line 2291
    .local v6, scroller:Landroid/widget/MyScroller;
    invoke-virtual {v6}, Landroid/widget/MyScroller;->computeScrollOffset()Z

    move-result v3

    .line 2292
    .local v3, more:Z
    invoke-virtual {v6}, Landroid/widget/MyScroller;->getCurrY()I

    move-result v7

    .line 2296
    .local v7, y:I
    iget v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mLastFlingY:I

    sub-int v0, v8, v7

    .line 2299
    .local v0, delta:I
    if-lez v0, :cond_3

    .line 2301
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v9, v9, Landroid/widget/MyAbsListView;->mFirstPosition:I

    iput v9, v8, Landroid/widget/MyAbsListView;->mMotionPosition:I

    .line 2302
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    const/4 v9, 0x0

    invoke-virtual {v8, v9}, Landroid/widget/MyAbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    .line 2303
    .local v1, firstView:Landroid/view/View;
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v1}, Landroid/view/View;->getTop()I

    move-result v9

    iput v9, v8, Landroid/widget/MyAbsListView;->mMotionViewOriginalTop:I

    .line 2306
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8}, Landroid/widget/MyAbsListView;->getHeight()I

    move-result v8

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    #getter for: Landroid/widget/MyAbsListView;->mPaddingBottom:I
    invoke-static {v9}, Landroid/widget/MyAbsListView;->access$1000(Landroid/widget/MyAbsListView;)I

    move-result v9

    sub-int/2addr v8, v9

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    #getter for: Landroid/widget/MyAbsListView;->mPaddingTop:I
    invoke-static {v9}, Landroid/widget/MyAbsListView;->access$1100(Landroid/widget/MyAbsListView;)I

    move-result v9

    sub-int/2addr v8, v9

    sub-int/2addr v8, v10

    invoke-static {v8, v0}, Ljava/lang/Math;->min(II)I

    move-result v0

    .line 2319
    .end local v1           #firstView:Landroid/view/View;
    :goto_1
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8, v0, v0}, Landroid/widget/MyAbsListView;->trackMotionScroll(II)V

    .line 2322
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v9, v9, Landroid/widget/MyAbsListView;->mMotionPosition:I

    iget-object v10, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v10, v10, Landroid/widget/MyAbsListView;->mFirstPosition:I

    sub-int/2addr v9, v10

    invoke-virtual {v8, v9}, Landroid/widget/MyAbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v4

    .line 2323
    .local v4, motionView:Landroid/view/View;
    if-eqz v4, :cond_2

    .line 2326
    invoke-virtual {v4}, Landroid/view/View;->getTop()I

    move-result v8

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v9, v9, Landroid/widget/MyAbsListView;->mMotionViewNewTop:I

    if-eq v8, v9, :cond_2

    .line 2327
    const/4 v3, 0x0

    .line 2331
    :cond_2
    if-eqz v3, :cond_4

    .line 2332
    iput v7, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mLastFlingY:I

    .line 2333
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8, p0}, Landroid/widget/MyAbsListView;->post(Ljava/lang/Runnable;)Z

    goto :goto_0

    .line 2309
    .end local v4           #motionView:Landroid/view/View;
    :cond_3
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8}, Landroid/widget/MyAbsListView;->getChildCount()I

    move-result v8

    sub-int v5, v8, v10

    .line 2310
    .local v5, offsetToLast:I
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    iget v9, v9, Landroid/widget/MyAbsListView;->mFirstPosition:I

    add-int/2addr v9, v5

    iput v9, v8, Landroid/widget/MyAbsListView;->mMotionPosition:I

    .line 2312
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8, v5}, Landroid/widget/MyAbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v2

    .line 2313
    .local v2, lastView:Landroid/view/View;
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v2}, Landroid/view/View;->getTop()I

    move-result v9

    iput v9, v8, Landroid/widget/MyAbsListView;->mMotionViewOriginalTop:I

    .line 2316
    iget-object v8, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v8}, Landroid/widget/MyAbsListView;->getHeight()I

    move-result v8

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    #getter for: Landroid/widget/MyAbsListView;->mPaddingBottom:I
    invoke-static {v9}, Landroid/widget/MyAbsListView;->access$1200(Landroid/widget/MyAbsListView;)I

    move-result v9

    sub-int/2addr v8, v9

    iget-object v9, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    #getter for: Landroid/widget/MyAbsListView;->mPaddingTop:I
    invoke-static {v9}, Landroid/widget/MyAbsListView;->access$1300(Landroid/widget/MyAbsListView;)I

    move-result v9

    sub-int/2addr v8, v9

    sub-int/2addr v8, v10

    neg-int v8, v8

    invoke-static {v8, v0}, Ljava/lang/Math;->max(II)I

    move-result v0

    goto :goto_1

    .line 2335
    .end local v2           #lastView:Landroid/view/View;
    .end local v5           #offsetToLast:I
    .restart local v4       #motionView:Landroid/view/View;
    :cond_4
    invoke-direct {p0}, Landroid/widget/MyAbsListView$FlingRunnable;->endFling()V

    goto/16 :goto_0
.end method

.method public start(I)V
    .locals 9
    .parameter "initialVelocity"

    .prologue
    const v6, 0x7fffffff

    const/4 v1, 0x0

    .line 2239
    if-gez p1, :cond_0

    move v2, v6

    .line 2240
    .local v2, initialY:I
    :goto_0
    iput v2, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mLastFlingY:I

    .line 2241
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    move v3, v1

    move v4, p1

    move v5, v1

    move v7, v1

    move v8, v6

    invoke-virtual/range {v0 .. v8}, Landroid/widget/MyScroller;->fling(IIIIIIII)V

    .line 2243
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    const/4 v1, 0x4

    iput v1, v0, Landroid/widget/MyAbsListView;->mTouchMode:I

    .line 2244
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v0, p0}, Landroid/widget/MyAbsListView;->post(Ljava/lang/Runnable;)Z

    .line 2252
    return-void

    .end local v2           #initialY:I
    :cond_0
    move v2, v1

    .line 2239
    goto :goto_0
.end method

.method public startUsingDistance(I)V
    .locals 6
    .parameter "distance"

    .prologue
    const/4 v1, 0x0

    .line 2270
    if-nez p1, :cond_0

    .line 2277
    :goto_0
    return-void

    .line 2272
    :cond_0
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v0, p0}, Landroid/widget/MyAbsListView;->removeCallbacks(Ljava/lang/Runnable;)Z

    .line 2274
    iput v1, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mLastFlingY:I

    .line 2275
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->mScroller:Landroid/widget/MyScroller;

    neg-int v4, p1

    const/16 v5, 0x320

    move v2, v1

    move v3, v1

    invoke-virtual/range {v0 .. v5}, Landroid/widget/MyScroller;->startScroll(IIIII)V

    .line 2276
    iget-object v0, p0, Landroid/widget/MyAbsListView$FlingRunnable;->this$0:Landroid/widget/MyAbsListView;

    invoke-virtual {v0, p0}, Landroid/widget/MyAbsListView;->post(Ljava/lang/Runnable;)Z

    goto :goto_0
.end method
